# Maintainer: atom2013 <atom.long@hotmail.com>

pkgbase=python-appdirs
pkgname=(python3-appdirs python2-appdirs)
pkgver=1.4.3
pkgrel=2
pkgdesc='A small Python module for determining appropriate platform-specific dirs, e.g. a "user data dir".'
arch=('any')
url="https://github.com/ActiveState/appdirs"
license=('MIT')
makedepends=('python3-setuptools' 'python2-setuptools')
source=("https://pypi.io/packages/source/a/appdirs/appdirs-$pkgver.tar.gz")
sha256sums=('9e5896d1372858f8dd3344faf4e5014d21849c756c8d5701f78f8a103b372d92')

prepare() {
  cp -a appdirs-$pkgver{,-py2}
}

build() {
  # Build python 3 module
  cd "$srcdir"/appdirs-$pkgver
  python3 setup.py build

  # Build python 2 module
  cd "$srcdir"/appdirs-$pkgver-py2
  python2 setup.py build
}

check() {
  # Check python3 module
  cd "$srcdir"/appdirs-$pkgver
  python3 setup.py test

  # Check python2 module
  cd "$srcdir"/appdirs-$pkgver-py2
  python2 setup.py test
}

package_python3-appdirs() {
  depends=('python3')

  cd appdirs-$pkgver
  python3 setup.py install --root="$pkgdir/" --optimize=1
  install -Dm644 LICENSE.txt "$pkgdir"/usr/share/licenses/$pkgname/LICENSE.txt
}

package_python2-appdirs() {
  depends=('python2')

  cd appdirs-$pkgver-py2
  python2 setup.py install --root="$pkgdir/" --optimize=1
  install -Dm644 LICENSE.txt "$pkgdir"/usr/share/licenses/$pkgname/LICENSE.txt
}

